package com.maxwell.googleplay.holder;

import android.view.View;
import android.widget.TextView;

import com.maxwell.googleplay.R;
import com.maxwell.googleplay.utils.UIUtils;

/**
 * @author yue
 * @创建时间 2016-3-30下午10:34:38
 * @描述 TODO
 * 
 */
public abstract class BaseHolder<HOLDERBEANTYPE> {
	public View mHolderView;
	
	public View getHolderView() {
		return mHolderView;
	}

	private HOLDERBEANTYPE mData;

	
	
	public BaseHolder() {
		// 初始化根布局
		mHolderView = initHolderView();
		// 绑定tag
		mHolderView.setTag(this);
	}
	
	/**@desc 设置数据并刷新视图
	 * @call 需要设置数据和刷新视图的时候调用
	 */
	public void setDataAndRefreshHolderView(HOLDERBEANTYPE data) {
		// 保存数据
		mData = data;
		// 刷新显示
		refreshHolderView(data);
	}

	/**@desc 初始化holderView的根视图
	 * @call 
	 * @return
	 */
	public abstract View initHolderView();
	
	/**
	 * @desc 刷新Holder视图
	 * @call 
	 */
	public abstract void refreshHolderView(HOLDERBEANTYPE data);

}
